package com.xc.h05.controller.changlongfei;

import com.xc.h05.entity.CoursereplyCLFV;
import com.xc.h05.service.changlongfei.VCoursereplyService;
import com.xc.h05.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/vcoursereply")
public class VCoursereplyController {
    @Autowired
    private VCoursereplyService vcoursereplyService;
    @RequestMapping("/getCoursereplyByPage")
    public R getCoursereplyByPage(int pageNum, int pageSize, CoursereplyCLFV coursereplyCLFV){
        return R.ok(vcoursereplyService.selectByPage(pageNum,pageSize,coursereplyCLFV));
    }
//    删除

    @DeleteMapping("/deleteByPrimaryKey")
    public R deleteByPrimaryKey(Long id){
        int i = vcoursereplyService.deleteByPrimaryKey(id);
        if (i == 0){
            return R.ok("删除失败");
        }else {
            return R.ok("删除成功");
        }
    }
//    批量删除
    @DeleteMapping("/deleteCoursereplyBatch")
    public R deleteCoursereplyBatch(Long[] ids){
        int i = vcoursereplyService.deleteCoursereplyBatch(ids);
        if (i == 0){
            return R.ok("删除失败");
        }else  {
            return R.ok("删除成功");
        }
    }
}
